﻿using Abp.Application.Services.Dto;
using ARchGL.Platform.Dto;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace ARchGL.Platform.Dtos
{
    /// <summary>
    /// 检查详情 ViewModel
    /// </summary>
    public class SecurityCheckDetailDto : EntityAndNumberDto
    {
        public SecurityCheckDetailDto()
        {
            CheckAndFeedbacksList = new List<SecurityCheckAndFeedbacksDto>();
        }

        #region 检查

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }
        /// <summary>
        /// 检查内容
        /// </summary>
        public string Content { get; set; }
        /// <summary>
        /// 检查结果
        /// </summary>
        public string Result { get; set; }
        /// <summary>
        /// 检查类型，获取检查项的根数据
        /// </summary>
        public Guid CheckItemId { get; set; }
        /// <summary>
        /// 检查类型名称
        /// </summary>
        public string CheckItemName { get; set; }
        /// <summary>
        /// 状态：1整改中/书面整改、2已整改/待复查、3已完成/通过、4已撤销
        /// </summary>
        public int Status { get; set; }
        /// <summary>
        /// 初始状态（不能被编辑）
        /// </summary>
        public int OriginStatus { get; set; }
        /// <summary>
        /// 执行检查性质名称
        /// </summary>
        public List<string> SecurityChecksPropertyNames { get; set; }
        /// <summary>
        /// 被检查部门名称
        /// </summary>
        public string OrganizationUnitName { get; set; }
        /// <summary>
        /// 执行检查日期
        /// </summary>
        public DateTime CheckDate { get; set; }
        /// <summary>
        /// 执行检查日期时间戳
        /// </summary>
        public long CheckDateUniversalTime { get { return CheckDate.ToUnixTimestamp(); } }
        /// <summary>
        /// 执行检查人标识集合
        /// </summary>
        public string CheckUsersArray { get; set; }
        /// <summary>
        /// 执行检查人名称集合
        /// </summary>
        public List<string> CheckUserNames { get; set; }
        /// <summary>
        /// 抄送人标识集合
        /// </summary>
        public string CCUsersArray { get; set; }
        /// <summary>
        /// 整改抄送人名称集合CCUsersArray
        /// </summary>
        public List<string> CCUserNames { get; set; }
        /// <summary>
        /// 创建人名称
        /// </summary>
        public string CreatorUserName { get; set; }

        /// <summary>
        /// 检查附件
        /// </summary>
        public List<string> Attachments { get; set; }
        /// <summary>
        /// 被通知人/整改人
        /// </summary>
        public string NotifyUsersArray { get; set; }
        /// <summary>
        /// 被通知人名称集合
        /// </summary>
        public List<string> NotifyUserNames { get; set; }
        /// <summary>
        /// 视图标识集合
        /// </summary>
        public string ProjectViewPortsArray { get; set; }
        /// <summary>
        /// 创建人标识
        /// </summary>
        public Guid? CreatorUserId { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreationTime { get; set; }
        /// <summary>
        /// 创建时间戳
        /// </summary>
        public long CreationUniversalTime { get { return CreationTime.ToUnixTimestamp(); } }

        #endregion

        #region 整改要求

        /// <summary>
        /// 整改要求（语言描述整改内容）
        /// </summary>
        public string CorrectContent { get; set; }
        /// <summary>
        /// 整改完成日期（截止日期）
        /// </summary>
        public DateTime? CorrectDate { get; set; }
        /// <summary>
        /// 整改完成日期时间戳
        /// </summary>
        public long CorrectDateUniversalTime
        {
            get
            {
                return CorrectDate.HasValue
                    ? CorrectDate.Value.ToUnixTimestamp()
                    : DateTime.MinValue.ToUnixTimestamp();
            }
        }
        /// <summary>
        /// 移交记录人名称集合
        /// </summary>
        public List<string> TurnOverHistoryUserNames { get; set; }

        #endregion

        #region 整改情况  回复与复查

        /// <summary>
        /// 整改与复查情况
        /// </summary>
        public List<SecurityCheckAndFeedbacksDto> CheckAndFeedbacksList { get; set; }

        #endregion
    }

    public abstract class EntityAndNumberDto : EntityDto<Guid>
    {
        /// <summary>
        /// 编号
        /// </summary>
        public string DisplayNumber { get; set; }
    }
}
